import React, { Component } from 'react';
import { Router, Route, hashHistory, IndexRedirect } from 'react-router';

const Page = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/Page').default)},'Page')};
const App = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/apps/App').default)},'App')};
const LoginPage = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/login/LoginPage').default)},'LoginPage')};

const Dashboard = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/dashboard/views/Dashboard').default)},'Dashboard')};

//待办任务
const UnCompleteTask = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/personal/views/UnCompleteTask').default)},'UnCompleteTask')};
// 已办任务
const CompleteTask = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/personal/views/CompleteTask').default)},'CompleteTask')};
// 我的建议
const SuggestionList = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/SuggestionList').default)},'SuggestionList')};
// 查看
const ViewSuggest = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/ViewSuggest').default)},'ViewSuggest')};
// 新建
const AddSuggest = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/AddSuggest').default)},'AddSuggest')};
// 未办理
const UnDisposed = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/UnDisposed').default)},'UnDisposed')};
// 办理中
const Apply = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/Apply').default)},'Apply')};
// 已办理
const Complete = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/Complete').default)},'Complete')};
// 已逾期
const OutOfTime = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/OutOfTime').default)},'OutOfTime')};
// 已评价
const Evaluated = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/Evaluated').default)},'Evaluated')};
//公开建议
const Published = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/Published').default)},'Published')};
// 统计分析
const Statistic = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/suggestion/views/Statistic').default)},'Statistic')};

//组织架构
const Organization = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/manage/views/Organization').default)},'Organization')};
// 用户管理
const User = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/manage/views/User').default)},'User')};
// 角色管理
const Role = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/manage/views/Role').default)},'Role')};
// 资源管理
const Resource = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/manage/views/Resource').default)},'Resource')};
// 权限管理
const Power = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/manage/views/Power').default)},'Power')};
// 数据字典
const Dict = (location,cb)=>{require.ensure([],require=>{cb(null, require('@/manage/views/Dict').default)},'Dict')};

class RouterContainer extends Component {
	
	render() {
        return (
            <Router history={hashHistory}>
                <Route path={'/'} getComponent={Page} >
					<IndexRedirect to='/login'/>
					<Route path={'login'} getComponent={LoginPage} />>
					<Route path={'app'} getComponent={App} >
						<Route path={'dashboard'} getComponent={Dashboard} />
						<Route path={'personal'} >
							<Route path={'unCompleteTask'} getComponent={UnCompleteTask} />
							<Route path={'completeTask'} getComponent={CompleteTask} />
						</Route>
						<Route path={'suggestion'} >
							<Route path={'addSuggest'} getComponent={AddSuggest} />
							<Route path={'suggestionList'} getComponent={SuggestionList} />
							<Route path={'viewSuggest/:id'} getComponent={ViewSuggest} />
							<Route path={'unDisposed'} getComponent={UnDisposed} />
							<Route path={'apply'} getComponent={Apply} />
							<Route path={'complete'} getComponent={Complete} />
							<Route path={'outOfTime'} getComponent={OutOfTime} />
							<Route path={'evaluated'} getComponent={Evaluated} />
							<Route path={'published'} getComponent={Published} />
							<Route path={'statistic'} getComponent={Statistic} />
						</Route>
						<Route path={'manage'} >
							<Route path={'organization'} getComponent={Organization} />
							<Route path={'user'} getComponent={User} />
							<Route path={'role'} getComponent={Role} />
							<Route path={'resource'} getComponent={Resource} />
							<Route path={'power'} getComponent={Power} />
							<Route path={'dict'} getComponent={Dict} />
						</Route>
					</Route>
				</Route>
            </Router>
		)
	}
}

export default RouterContainer;
